import { Page } from '#/api.ts';
import apiClient from '@/api/apiClient.ts';
import { DeviceInfo, EventInfo } from '#/entity.ts';

export enum EventCenterApi {
  GetDeviceList = '/roadCure/eventCenter/getDeviceList',
  GetAlarmTypeList = 'roadCure/eventCenter/getAlarmTypeList',
  GetList = 'roadCure/eventCenter/getEventCenterList',
}

export interface EventCenterListParams {
  alarmDesc?: string;
  alarmPosition?: string;
  carNoList?: string[];
  handleStatus?: string;
}

const getDeviceList = () => apiClient.get<DeviceInfo[]>({ url: EventCenterApi.GetDeviceList });

const getAlarmTypeList = () => apiClient.get<string[]>({ url: EventCenterApi.GetAlarmTypeList });

const getEventCenterList = (data: EventCenterListParams & Page) =>
  apiClient.post<EventInfo[]>({
    url: EventCenterApi.GetList,
    data,
  });

export default {
  getDeviceList,
  getAlarmTypeList,
  getEventCenterList,
};
